package com.sy.service;

import com.sbring.BeanPostProcessor;
import com.sbring.Component;

//@Component("beanPostProcessor2")
public class BeanPostProcessor2 implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        System.out.println("BeanPostProcessor2->"+beanName + "->初始化前");
        return null;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
        System.out.println("BeanPostProcessor2->"+beanName + "->初始化后");
        if (beanName.equals("orderService")) {
            ((OrderService)bean).setName("我有名字了！");
        }
        return null;
    }
}
